import request from "@/utils/axios/request";

const addMeeting = (data: any) => {
  return request.post("/meeting/addMeeting", data);
};

const getMeetings = (params: {
  id?: string;
  pageNum?: any;
  pageSize?: any;
  name?: any;
}) => {
  return request.get(
    `/meeting/getMeetings?pageNum=${params.pageNum}&pageSize=${params.pageSize
    }&name=${params.name}${params.id ? `&id=${params.id}` : ""}`
  );
};

const delMeeting = (ids: Array<number>) => {
  return request.post("/meeting/delMeeting", ids);
};

const updateMeeting = (data: any) => {
  return request.post("/meeting/updateMeeting", data);
};

const addMeetingUsers = (data: { meetingId: string, userIds: Array<number> }) => {
  return request.post("/meeting/addMeetingUsers", data);
};

const delMeetingUsers = (data: { meetingId: string, userIds: Array<number> }) => {
  return request.post("/meeting/delMeetingUsers", data);
};

const sendEmail = (data: { meetingId: string, userId: string }) => {
  return request.post("/meeting/sendEmail", data);
};

const updateInterViewTime = (data: { interviewId: string, begin: string, end: string, interviewer_id?: string }) => {
  return request.post("/meeting/updateInterViewTime", data);
};

const meetingApi = {
  addMeeting,
  getMeetings,
  delMeeting,
  updateMeeting,
  addMeetingUsers,
  delMeetingUsers,
  sendEmail,
  updateInterViewTime,
};

export default meetingApi
